const BaseHandler = require('../base-handler');
const SystemServices = require('../../../constants').SystemServices;
const HTTP_VERBS = require('../../../constants').HTTP_VERBS;

class SetProfileHandler extends BaseHandler {
    get pattern() {
        return "/setprofile";
    }

    doGET(request, response) {
        if (!request.session.user.authenticated) {
            response.redirect('/login');
        } else {
            // var user = request.session.user;
            // this.Controller.getUserProfile(user.id, (result) => {
            //     user.email = 'sunye@parllay.cn';
            //     user.profile_image = '';
            //     response.render('setprofile', {
            //         user: user
            //     })
            // });
            response.render('setprofile', {
                user: request.session.user
            });
        }
    }

    setup() {
        this.registerVerb(HTTP_VERBS.GET, this.doGET);
    }
}

module.exports = SetProfileHandler;